package paginas;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.io.File;
import java.util.Hashtable;
import java.util.ResourceBundle;

import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSlider;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

import modelUtil.Util;
import usuario.usuarioTO.UsuarioTO;
import util.BotonPersonalizado;

public class MenuUsuarioVozTab extends JPanel{



	private JPanel panel1;
	private JPanel panel2;
	private JPanel panel3;
	private JTextField texto1;
	private JTextField texto2;
	private JComboBox desplegable;
	private JLabel imagenMostrada = new JLabel();
	private File imagen;
	private UsuarioTO _user;

	public MenuUsuarioVozTab(UsuarioTO user){
		_user = user;
		this.setPreferredSize(new Dimension(700, 500));
		panel1 = new JPanel();
		panel2 = new JPanel();
		panel3 = new JPanel();

		initComponents();
		
	}
	
	public MenuUsuarioVozTab(){
		//_user = user;
		this.setPreferredSize(new Dimension(700, 500));
		panel1 = new JPanel();
		panel2 = new JPanel();
		panel3 = new JPanel();

		initComponents();
		
	}
	
	private void initComponents(){
		
		TitledBorder border = new TitledBorder(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_menu_usuarios_voz_titulo"));
		border.setTitleFont(new Font("Verdana", Font.BOLD, 18));
		this.setBorder(border);
		GridLayout grid2 = new GridLayout(3,1);
		this.setLayout(grid2);
		crearPanel1();
		grid2.addLayoutComponent("panel1", panel1);
		this.add(panel1);
		crearPanel2();
		grid2.addLayoutComponent("panel1", panel2);
		this.add(panel2);
		crearPanel3();
		grid2.addLayoutComponent("panel1", panel3);
		this.add(panel3);
		
		
	}
	
	private void crearPanel1(){
		
		GridBagLayout grid = new GridBagLayout();
		GridBagConstraints cons = new GridBagConstraints();
		panel1.setLayout(grid);
		cons.gridheight = 1;
		cons.gridwidth = 1;
		cons.gridx = 0;
		cons.gridy = 0;
		JLabel titulo = new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_menu_usuarios_voz_voces_disponibles"));
		grid.addLayoutComponent(titulo, cons);
		panel1.add(titulo);
		
		cons.gridx = 0;
		cons.gridy = 1;
		cons.gridwidth = 2;
		desplegable = new JComboBox();
		desplegable.setPreferredSize(new Dimension(450,30));
		panel2.add(desplegable);
		desplegable.addItem("0.25");
		desplegable.addItem("0.5");
		desplegable.addItem("0.75");
		desplegable.addItem("1");
		desplegable.addItem("1.5");
		desplegable.addItem("2");
		desplegable.addItem("3");
		desplegable.addItem("4");
		desplegable.addItem("5");
		desplegable.addItem("6");
		desplegable.addItem("7");
		desplegable.addItem("8");
		desplegable.addItem("9");
		desplegable.addItem("10");
		grid.addLayoutComponent(desplegable, cons);
		panel1.add(desplegable);
		JTextField texto = new JTextField(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_menu_usuarios_voz_texto_escribir"));
		texto.setPreferredSize(new Dimension(300,30));
		
		cons.gridx = 0;
		cons.gridy = 2;
		cons.gridwidth = 1;
		texto.setEditable(true);
		cons.insets = new Insets(10, 0, 0, 0);
		grid.addLayoutComponent(texto, cons);
		panel1.add(texto);
		BotonPersonalizado boton = Util.BotonImagen(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_menu_usuarios_voz_probar"),"");
		boton.setPreferredSize(new Dimension(150,30));
		boton.setBorder(null);
		boton.setFont(new Font("Verdana",Font.PLAIN,12));
		boton.setFont(null);
		cons.gridx = 1;
		grid.addLayoutComponent(boton, cons);
		panel1.add(boton);
		panel1.setVisible(true);
				
	}
	
	private void crearPanel2(){
		
        //Create the label table.
        Hashtable<Integer, JLabel> labelTable = 
            new Hashtable<Integer, JLabel>();
        //PENDING: could use images, but we don't have any good ones.
        labelTable.put(new Integer( 0 ),
                       new JLabel("MIN") );
        labelTable.put(new Integer( 100 ),
                       new JLabel("MAX") );

	 GridLayout grid = new GridLayout(2, 1);
	 panel2.setLayout(grid);
	 JLabel titulo = new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_menu_usuarios_voz_volumen"));
	 JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 50);
	 slider.setLabelTable(labelTable);
	 slider.setMajorTickSpacing(100);
	 slider.setMinorTickSpacing(1);
	 slider.setPaintTicks(true);
	 slider.setPaintLabels(true);
	 slider.setPreferredSize(new Dimension(450,50));
	 //slider.addChangeListener(new cambioSlider());
	 grid.addLayoutComponent("titulo", titulo);
	 panel2.add(titulo);
	 grid.addLayoutComponent("slider", slider);
	 panel2.add(slider);
		
	}
	
	private void crearPanel3(){
		
        //Create the label table.
        Hashtable<Integer, JLabel> labelTable = 
            new Hashtable<Integer, JLabel>();
        //PENDING: could use images, but we don't have any good ones.
        labelTable.put(new Integer( 0 ),
                       new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_menu_usuarios_voz_velocidad_lento")) );
        labelTable.put(new Integer( 100 ),
                       new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_menu_usuarios_voz_velocidad_rapido")) );

	 GridLayout grid = new GridLayout(2, 1);
	 panel3.setLayout(grid);
	 JLabel titulo = new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_menu_usuarios_voz_velocidad"));
	 JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 50);
	 slider.setLabelTable(labelTable);
	 slider.setMajorTickSpacing(100);
	 slider.setMinorTickSpacing(1);
	 slider.setPaintTicks(true);
	 slider.setPaintLabels(true);
	 slider.setPreferredSize(new Dimension(450,50));
	 //slider.addChangeListener(new cambioSlider());
	 grid.addLayoutComponent("titulo", titulo);
	 panel3.add(titulo);
	 grid.addLayoutComponent("slider", slider);
	 panel3.add(slider);

		
	}
	


	public JPanel getPanel3() {
		return panel3;
	}

	public void setPanel3(JPanel panel3) {
		this.panel3 = panel3;
	}

	public JTextField getTexto1() {
		return texto1;
	}

	public void setTexto1(JPasswordField texto1) {
		this.texto1 = texto1;
	}

	public JTextField getTexto2() {
		return texto2;
	}

	public void setTexto2(JTextField texto2) {
		this.texto2 = texto2;
	}

	public File getImagen() {
		return imagen;
	}

	public void setImagen(File imagen) {
		this.imagen = imagen;
	}

	public JLabel getImagenMostrada() {
		return imagenMostrada;
	}

	public void setImagenMostrada(JLabel imagenMostrada) {
		this.imagenMostrada = imagenMostrada;
	}

		
	
}
